package com.nuc.thread.synchronizedTest;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author 诗酒趁年华
 * @version 1.0.0
 * @Description
 * @createTime 2021年07月10日 08:31:00
 */
@Slf4j
public class TestPark {
    @SneakyThrows
    public static void main(String[] args) {

        Thread t1 = new Thread(() -> {
            log.debug("t1线程执行");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("park...");
            LockSupport.park();
            log.debug("t1线程恢复");

        }, "t1");
        t1.start();

        Thread.sleep(2000);
        LockSupport.unpark(t1);
    }
}
